package com.project.medical.sys.service.impl;

import com.project.medical.sys.common.utils.PageUtils;
import com.project.medical.sys.common.utils.Query;
import com.project.medical.sys.entity.DoctorEntity;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.project.medical.sys.dao.MedicMachineDao;
import com.project.medical.sys.entity.MedicMachineEntity;
import com.project.medical.sys.service.MedicMachineService;


@Service("medicMachineService")
public class MedicMachineServiceImpl extends ServiceImpl<MedicMachineDao, MedicMachineEntity> implements MedicMachineService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String) params.get("key");
        QueryWrapper<MedicMachineEntity> wrapper = new QueryWrapper<>();
        if (StringUtils.isNotEmpty(key)){

            wrapper.eq("id",key).or().like("name",key);
        }
        IPage<MedicMachineEntity> page = this.page(
                new Query<MedicMachineEntity>().getPage(params),
                new QueryWrapper<MedicMachineEntity>()
        );

        return new PageUtils(page);
    }

}